package com.tedu.mybatis.mapper;

import com.tedu.mybatis.pojo.*;
import org.apache.ibatis.annotations.*;
import org.springframework.context.annotation.Scope;

import java.util.List;

@Mapper
public interface WeiboMapper {
//    @Insert("INSERT INTO weibo(content,created,user_id)" +
//            "VALUES (#{content},#{created},#{userId})")
    int insertWeibo(Weibo weibo);
    //@Delete("DELETE FROM weibo " +
      //      "WHERE id=#{id}")
    int deleteById(Integer id);
//    @Update("UPDATE weibo " +
//            "SET content=#{content},created=#{created},user_id=#{userId} " +
//            "WHERE id=#{id}")
    int updateById(Weibo weibo);
//    @Select("SELECT id,content,created,user_id userId " +
//            "FROM weibo " +
//            "WHERE id=#{id}")
    Weibo selectById(Integer id);
//    @Select("SELECT id,content,created,user_id userId " +
//            "FROM weibo")
    List<Weibo> selectAll();
//    @Select("SELECT content,created " +
//            "FROM weibo " +
//            "WHERE id=#{id}")
    WeiboVO1 selectWeiboVO1ById(Integer id);
//    @Select("SELECT content,user_id userId  " +
//            "FROM weibo")
    List<WeiboVO2> selectWeiboVO2();

    int dynamicUpdateById(Weibo weibo);

    int dynamicDeleteById(Integer[] ids);//数组类型

    int dynamicDeleteById2(List<Integer> ids);//集合类型，存储整数
    //测试使用映射表将结果集对应到返回的WeiboVO3中，学习映射表的使用(WeiboMapper.xml)中配置
    WeiboVO3 selectResultMap(Integer id);

    WeiboVO4 selectWeiboAndCommentById(Integer id);

    int countWeibo();
}
